package piece5.chapter17;

public class MyStack {
    private MyArrayList list = new MyArrayList();

    public boolean isEmpty() {
	return list.isEmpty();
    }

    public int getSize() {
	return list.size();
    }

    public Object peek() {
	return list.get(getSize() - 1);
    }

    public Object pop() {
	Object object = list.get(getSize() - 1);
	list.remove(getSize() - 1);
	return object;
    }

    public Object push(Object o) {
	list.add(o);
	return o;
    }

    public int search(Object o) {
	return list.lastIndexOf(o);
    }

    @Override
    public String toString() {
	return "STACK:" + list.toString();
    }

}
